package com.DHH.Service.Base.Impl;
import com.DHH.Entity.Base.BasePower;
import com.DHH.Mapper.Base.BasePowerMapper;
import com.DHH.Service.Base.IBasePowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BasePowerServiceImpl implements IBasePowerService{
	
	@Autowired
    private BasePowerMapper basePowerMapper;
    
   @Override
   public BasePower insertBasePower(BasePower basePower){
	   
        basePowerMapper.insertSelective(basePower);
	   return basePower;
	   
   };
   @Override
   public BasePower updateBasePower(BasePower basePower){
	     basePowerMapper.updateByPrimaryKeySelective(basePower);
        return basePower;
   };
   @Override
   public BasePower deleteBasePower(BasePower basePower){

	     basePowerMapper.delete(basePower);
        return basePower;
   };
    /**
     * 保存或更新操作，返回值为主表
     */
    public BasePower saveOrUpdateBasePower(BasePower basePower){
        if(basePower.getId()==null)
        {
            basePowerMapper.insertSelective(basePower);
        }else{
            basePowerMapper.updateByPrimaryKeySelective(basePower);
        }
        return basePower;
    };
}
